package com.itheima.controller;

import com.itheima.pojo.entity.Result;
import com.itheima.pojo.option.ClazzOption;
import com.itheima.pojo.option.JobOption;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author zzw
 * @date 2025/4/27
 * @description 数据统计
 */
@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    /**
     * 员工岗位数据统计
     *
     * @return Result
     */
    @GetMapping("/empJobData")
    public Result getEmpJodData() {
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    /**
     * 员工性别数据统计
     *
     * @return Result
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        List<Map<String, Object>> genderDatalist = reportService.getEmpGenderData();
        log.info("员工性别数据统计：{}", genderDatalist);
        return Result.success(genderDatalist);
    }

    /**
     * 学生学历数据统计
     *
     * @return Result
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData() {
        List<Map<String, Object>> degreeDatalist = reportService.getStudentDegreeData();
        log.info("学生学历数据统计：{}", degreeDatalist);
        return Result.success(degreeDatalist);
    }

    /**
     * 班级人数统计
     *
     * @return Result
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData() {
        ClazzOption clazzOption = reportService.getStudentCountData();
        log.info("班级人数数据统计：{}", clazzOption);
        return Result.success(clazzOption);
    }
}
